<?php if (!defined('THINK_PATH')) exit(); /*a:7:{s:87:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\Role\index.html";i:1530770480;s:85:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\pub\head.html";i:1530180945;s:85:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\pub\left.html";i:1530771833;s:85:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\role\add.html";i:1530757299;s:86:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\role\edit.html";i:1530759018;s:85:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\role\del.html";i:1530493958;s:85:"E:\web-linux-20180129\linux\checkorder\public/../application/order\view\pub\foot.html";i:1530087406;}*/ ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<title>角色管理</title>
	<!--ztree-->
	<link rel="stylesheet" href="__JS__/ztree/demo.css" type="text/css">
	<link rel="stylesheet" href="__JS__/ztree/metroStyle.css" type="text/css">

	<!-- bootstrap -->
	<link href="__CSS__/bootstrap/bootstrap.css" rel="stylesheet" />

	<!-- libraries -->
	<!-- <link href="css/libs/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css" /> -->
	<link href="__CSS__/libs/font-awesome.css" type="text/css" rel="stylesheet" />

	<!-- global styles -->
	<link rel="stylesheet" type="text/css" href="__CSS__/compiled/layout.css">
	<link rel="stylesheet" type="text/css" href="__CSS__/compiled/elements.css">

	<!-- this page specific styles -->
	<link rel="stylesheet" type="text/css" href="__CSS__/libs/bootstrap-wizard.css">
	<link rel="stylesheet" href="__CSS__/libs/select2.css" type="text/css" />

	<link rel="stylesheet" href="__CSS__/new.css"/>
	<link rel="stylesheet" href="__CSS__/table.css"/>
	<link rel="stylesheet" href="__CSS__/bootstrap-table.css"/>
	<link rel="stylesheet" href="__CSS__/bootstrap-table-fixed-columns.css"/>


	<!-- Favicon -->
	<!--<link type="image/x-icon" href="favicon.png" rel="shortcut icon"/>-->

	<!-- google font libraries -->
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300|Titillium+Web:200,300,400' rel='stylesheet' type='text/css'>

	<!--[if lt IE 9]>
	<!--<script src="__JS__/html5shiv.js"></script>
	<script src="__JS__/respond.min.js"></script>-->
	<![endif]-->
	<!--[if lt IE 8]>-->
		<!--<link href="__CSS__/libs/font-awesome-ie7.css" type="text/css" rel="stylesheet" />-->
	<script>
	  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

	  ga('create', 'UA-49262924-1', 'phoonio.com');
	  ga('send', 'pageview');

	</script>
	<style>
		.main-box{
			min-height: 820px;
		}
		@media (max-width:1320px){
			.main-box{
				min-height: 600px;
			}
		}

		.fixed-table-body-columns{
			height: 486px!important;
			top: 47px!important;
		}
		/*弹出框*/
		.wizard-steps{
			display: none;
		}
		.wizard-card{
			width:400px!important;
			height: 400px!important;
		}
		.wizard-modal.modal{
			width:400px!important;
			height: 520px!important;
			margin-left: -200px!important;
		}
		.wizard-back{
			display: none!important;
		}
		.calCancel{
			float: right;
		}
		.forhid{
			display: none;
		}
		/*提示框*/
		#msg{
			background: rgba(255,255,255,0.6);
			border:1px solid #faf2cc;
			text-align:center;
			min-width: 100px;
			max-width: 200px;
			height: 30px;
			margin-left: 45%;
			border-radius: 3px;
		}

	</style>
</head>
<body>
	<!--head-->
	<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="__CSS__/other.css"/>

</head>
<body>
<header class="navbar" id="header-navbar">
    <div class="container">
        <a href="index.html" id="logo" class="navbar-brand col-md-3 col-sm-3 col-xs-12">
            <img src="__IMG__/logo.png" class="img" alt=""/>
        </a>

        <button class="navbar-toggle" data-target=".navbar-ex1-collapse" data-toggle="collapse" type="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="fa fa-bars"></span>
        </button>

        <div class="nav-no-collapse pull-right" id="header-nav">
            <ul class="nav navbar-nav pull-right">

                <li class="dropdown profile-dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <span class="hidden-xs">welcome</span> <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="user-profile.html"><i class="fa fa-user"></i>Profile</a></li>
                        <li><a href="#"><i class="fa fa-cog"></i>Settings</a></li>
                        <li><a href="#"><i class="fa fa-envelope-o"></i>Messages</a></li>
                        <li><a href="#"><i class="fa fa-power-off"></i>Logout</a></li>
                    </ul>
                </li>
                <li class="hidden-xxs">
                    <a class="btn" title="退出登录">
                        <i class="fa fa-power-off"></i>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</header>
</body>
</html>

	<div class="container" role="main">
		<div class="row">

			<!--left-->
			<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #sidebar-nav .nav li .submenu > li > a.active{
            background-color: #313131;
        }
    </style>
</head>
<body>
<div class="col-md-2" id="nav-col">
    <section id="col-left">
        <div class="collapse navbar-collapse navbar-ex1-collapse" id="sidebar-nav">
            <ul class="nav nav-pills nav-stacked" id="menulist">
                <li>
                    <a href="<?php echo url('Index/index'); ?>">
                        <i class="fa fa-dashboard"></i>
                        <span>首页</span>
                    </a>
                </li>
                <li>
                    <a href="#" class="dropdown-toggle">
                        <i class="fa fa-users"></i>
                        <span>系统管理</span>
                        <i class="fa fa-chevron-circle-down drop-icon"></i>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<?php echo url('Way/index'); ?>">
                                操作菜单管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Role/index'); ?>">
                                角色管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Dept/index'); ?>">
                                部门管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Admin/index'); ?>">
                                用户管理
                            </a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#" class="dropdown-toggle">
                        <i class="fa fa-cogs"></i>
                        <span>可配置项管理</span>
                        <i class="fa fa-chevron-circle-down drop-icon"></i>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<?php echo url('MeterType/index'); ?>">
                                基表型号管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('ModelType/index'); ?>">
                                电子模块类型管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Principle/index'); ?>">
                                生产负责人管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Fitting/index'); ?>">
                                配件管理
                            </a>
                        </li>
                        <li>
                            <a href="<?php echo url('Program/index'); ?>">
                                方案管理
                            </a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#" class="dropdown-toggle">
                        <i class="fa fa-money"></i>
                        <span>订单管理</span>
                        <i class="fa fa-chevron-circle-down drop-icon"></i>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<?php echo url('Order/index'); ?>">
                                订单信息
                            </a>
                        </li>
                        <!--<li>
                            <a href="<?php echo url('Index/index'); ?>">
                               统计报表
                            </a>
                        </li>-->

                    </ul>
                </li>

            </ul>
        </div>
    </section>
</div>
<script src="__JS__/jquery.js"></script>
<script>
    //菜单动态选中 js
    //获取当前地址栏中的链接
    var urlstr = location.href;
    var urlstatus=false;
    var menu_obj = $("#menulist a");
    //遍历所有菜单
    menu_obj.each(function () {
        //判断当前菜单是否存在
        if((urlstr + '/').indexOf($(this).attr('href')) > -1 && $(this).attr('href')!='')
        {
            $(this).addClass('active');
            $(this).parent().parent().parent().addClass('active'); //针对有多级菜单选中的样式添加
            urlstatus = true;
        }
        else
        {
            $(this).parent().removeClass('active');
        }
    });
    //加载页面默认选中第一个
    /*if(!urlstatus)
    {
        menu_obj.parent().eq(0).addClass('active');
    }*/
</script>
</body>
</html>
			<div class="col-md-10" id="content-wrapper">
				<!--<h2 class="pull-left">Last orders</h2>-->
				<div class="row">
					<div class="col-lg-12">

							<div class="col-lg-12">
								<div class="main-box">

									<!--提示框-->
									<div id="msg">
										<img src="__IMG__/success.png" id="img" alt="" style="float: left;height: 29px;width: 36px;">
										<span id="sp" style="font-size: 14px;line-height: 30px;">提示信息</span>
									</div>

									<div class="clear-fix">
										<button id="open-wizard" class="btn btn-primary">
											<i class="fa fa-plus-circle fa-lg"></i> 添加角色
										</button>

										<div class="filter-block pull-right">
											<form action="<?php echo url('Role/search'); ?>" method="post">
												<div class="form-group pull-left">
													<input type="text" class="form-control" name="search" placeholder="Search...">
												</div>
												<button class="btn btn-primary pull-right">
													<i class="fa fa-search search-icon"></i> 搜索
												</button>
											</form>
										</div>

									</div>
									<br>
									<div class="table-responsive clearfix">
										<table id="fixedTable" class="table table-striped jambo_table table-hover" data-toggle="table">
											<thead>
												<tr>

													<th><span>角色编号</span></th>
													<th><span>角色名称</span></th>
													<th><span>备注</span></th>
													<th><span>添加日期</span></th>
													<!--<th><span>状态</span></th>-->
													<th><span>操作</span></th>
												</tr>
											</thead>
											<tbody>
												<?php if(is_array($roles) || $roles instanceof \think\Collection): $i = 0; $__LIST__ = $roles;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
												<tr>
													<td><?php echo $v['role_id']; ?></td>
													<td><?php echo $v['role_name']; ?></td>
													<td><?php echo $v['remark']; ?></td>
													<td><?php echo $v['create_time']; ?></td>
													<!--<td><?php echo $v['status']; ?></td>-->
													<td>
														<a class="table-link" title="修改" onclick=edit("<?php echo $v['role_id']; ?>","<?php echo $v['wid']; ?>")>
															<span class="fa-stack">
																<i class="fa fa-square fa-stack-2x"></i>
																<i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
															</span>
														</a>
														<a class="table-link danger class-del" onclick=del("<?php echo $v['role_id']; ?>") title="删除">
															<span class="fa-stack">
																<i class="fa fa-square fa-stack-2x"></i>
																<i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
															</span>
														</a>
													</td>
												</tr>
												<?php endforeach; endif; else: echo "" ;endif; ?>

											</tbody>
										</table>
										<!--分页-->
										<div style="float: right;">
											<?php echo $page; ?>
										</div>
									</div>

									<!--添加弹出框-->
									<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--添加弹出框-->
<div class="wizard" id="wizard-demo">
    <form method="post" onsubmit="add()" id="addForm">
        <!--<h1>添加角色</h1>-->
        <div class="wizard-card" data-onValidated="setServerName" data-cardname="name">
            <h3 class="text-center"><span>添加角色</span></h3>

            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">角色名 <span class="required">*</span>
                    </label>
                    <div>
                        <input type="text" id="last-name" name="role_name_add" required="required" class="form-control col-md-7 col-xs-12">
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">备注
                    </label>
                    <div>
                        <input type="text" name="remark_add" class="form-control col-md-7 col-xs-12">
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label for="middle-name" class="control-label">状态 <span class="required">*</span></label>
                    <div>
                        <select id="middle-name" class="form-control col-md-7 col-xs-12" name="status_add" required="required">
                            <option value="1" selected>正常</option>
                            <option value="0">禁用</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">权限 <span class="required">*</span>
                    </label>
                    <div style="margin-left: 16px;margin-top: -6px;">
                        <div class="zTreeDemoBackground left form-group">
                            <ul id="treeAdd" class="ztree"></ul>
                            <input type="hidden" name="wid_add" value="">
                        </div>

                    </div>
                </div>
            </div>

        </div>

    </form>
</div>
<!--添加弹出框-->
<script src="__JS__/jquery.js"></script>
<!--ztree-->
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.core.js"></script>
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.excheck.js"></script>
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.exedit.js"></script>
<script type="text/javascript">
    var setting = {
        view: {
            selectedMulti: true             /*允许选中多个节点*/
        },
        check: {
            enable: true,
            autoCheckTrigger: true
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        edit: {
            enable: false
        }
    };
    setting.check.chkboxType = { "Y" : "s", "N" : "s" };

    var data = '<?php echo $jsonways; ?>'
    data = JSON.parse(data);
    var zNodes = [];
    //console.log(data)
    for(var i=0;i<data.length;i++){
        if(data[i].pid == '0'){
            zNodes[i] = {id:data[i].wid, pId:data[i].pid, name:data[i].w_name, isParent:true}
        }else{
            zNodes[i] = {id:data[i].wid, pId:data[i].pid, name:data[i].w_name}
        }
    }

    $(document).ready(function(){
        $.fn.zTree.init($("#treeAdd"), setting, zNodes);
        /*添加的*/
        var treeObj = $.fn.zTree.getZTreeObj("treeAdd");

        var nodes = treeObj.getChangeCheckedNodes()
        //nodes = Json
        //console.log(nodes)
        var tree = '';
        for(var i=0;i<nodes.length;i++){
            var treeNode = nodes[i]
            if(treeNode.checked == true){
                tree += treeNode.id + ',';
            }
            //console.log((treeNode?treeNode.name:"root") + "checked " +(treeNode.checked?"true":"false"));
        }
        $("input[name='wid_add']").val(tree)
    });

    var newCount = 1;
    function addHoverDom(treeId, treeNode) {
        var sObj = $("#" + treeNode.tId + "_span");
        if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
        /*var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
            + "' title='add node' onfocus='this.blur();'></span>";
        sObj.after(addStr);*/
        var btn = $("#addBtn_"+treeNode.tId);
        if (btn) btn.bind("click", function(){
            var zTree = $.fn.zTree.getZTreeObj("treeAdd");
            zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, name:"new node" + (newCount++)});
            return false;
        });
    }
    function removeHoverDom(treeId, treeNode) {
        $("#addBtn_"+treeNode.tId).unbind().remove();
    }

    function addTree() {
        var treeObj = $.fn.zTree.getZTreeObj("treeAdd");
        var nodes = treeObj.getCheckedNodes();
        //console.log(nodes,'nodesnodesnodesnodes')
        /*var role_name = $("input[name='role_name']").val()
        var remark = $("input[name='remark']").val()
        var status = $("select[name='status']").val()*/

        var tree = '';
        for(var i=0;i<nodes.length;i++){
            var treeNode = nodes[i]
            if(treeNode.checked == true){
                tree += treeNode.id + ',';
            }
            //console.log((treeNode?treeNode.name:"root") + "checked " +(treeNode.checked?"true":"false"));
        }
        //console.log(tree)
        $("input[name='wid_add']").val(tree)

        //var jsonData = {'role_name':role_name,'remark':remark,'status':status,'wid':tree}
        //console.log(jsonData)
        //alert(jsonData)
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: '' ,//url
            data: '',
            success: function (result) {

            }
        });
    }
    //console.log(setting.treeObj)
</script>
</body>
</html>
									<!--修改弹出框-->
									<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--修改弹出框-->
<div class="wizard" id="wizard-edit">
    <form method="post" id="addForm">
        <!--<h1>添加角色</h1>-->
        <div class="wizard-card" data-onValidated="setServerName" data-cardname="name">
            <h3 class="text-center"><span>修改角色权限</span></h3>
            <input type="hidden" name="role_id_edit">
            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">角色名 <span class="required">*</span>
                    </label>
                    <div>
                        <input type="text" id="last-name" name="role_name" required="required" class="form-control col-md-7 col-xs-12">
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">备注
                    </label>
                    <div>
                        <input type="text" name="remark" class="form-control col-md-7 col-xs-12">
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label for="middle-name" class="control-label">状态 <span class="required">*</span></label>
                    <div>
                        <select id="middle-name" class="form-control col-md-7 col-xs-12" name="status" required="required">
                            <option value="1" selected>正常</option>
                            <option value="0">禁用</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="wizard-input-section">
                <div class="form-group">
                    <label class="control-label" for="last-name">权限 <span class="required">*</span>
                    </label>
                    <div class="zTreeDemoBackground left form-group">
                        <ul id="treeDemo" class="ztree"></ul>
                        <input type="hidden" name="wid">
                    </div>

                </div>
            </div>

        </div>

    </form>
</div>
<!--修改弹出框-->
<script src="__JS__/jquery.js"></script>
<!--ztree-->
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.core.js"></script>
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.excheck.js"></script>
<script type="text/javascript" src="__JS__/ztree/jquery.ztree.exedit.js"></script>
<script>
    function setEditValue(role_id) {
        $.post("<?php echo url('Role/one'); ?>",{role_id:role_id},function(data){
            //console.log(data);
            if(data) {
                $("input[name='role_id_edit']").val(data[0].role_id)
                $("input[name='role_name']").val(data[0].role_name);
                $("input[name='wid']").val(data[0].wid);
                $("input[name='remark']").val(data[0].remark);
                $("select[name='status']").val(data[0].status);
            }
        },'json');
    }
    function edit(role_id, wid) {
        setEditValue(role_id)
        //console.log(widString)
        var foredit = $("#wizard-edit").wizard({
            showCancel: true
        });
        foredit.show()
        $('.wizard-cancel').text('取消');
        $('.wizard-cancel').addClass('calCancel')
        // $('.wizard-next').addClass('calCancel')
        $('.wizard-next').text('确定');

        /*权限树*/
        var settingEdit = {
            view: {
                selectedMulti: true             /*允许选中多个节点*/
            },
            check: {
                enable: true,
                autoCheckTrigger: true
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            edit: {
                enable: false
            }
        };
        settingEdit.check.chkboxType = { "Y" : "s", "N" : "s" };

        var datae = '<?php echo $jsonways; ?>';
        datae = JSON.parse(datae);
        //console.log(data)
        //获取wid值
        var widString = wid
        console.log(widString+'12121212')
        /*去掉最后一个逗号*/
        widString = widString.substr(0, widString.length-1)
        var widArr = widString.split(',');
        var widLen = widArr.length;
        /*整数数组*/
        /*var intWid = [];
        intWid = widArr.map(function(data){
            return +data;
        });*/

        var zNodese = [];
        for(var i=0;i<datae.length;i++){
            for(var j=0;j<widLen;j++){
                //父节点
                if(datae[i].pid == 0){
                    if(datae[i].wid == widArr[j]){
                        datae[i].checked = true;
                    }
                    zNodese[i] = {id:datae[i].wid, pId:datae[i].pid, name:datae[i].w_name, isParent:true, checked:datae[i].checked}
                }else {    //子节点
                    if(datae[i].wid == widArr[j]){
                        datae[i].checked = true;
                    }
                    zNodese[i] = {id:datae[i].wid, pId:datae[i].pid, name:datae[i].w_name, checked:datae[i].checked}
                }
            }
        }

        $(document).ready(function(){
            $.fn.zTree.init($("#treeDemo"), settingEdit, zNodese);
            /*添加的*/
            var treeObje = $.fn.zTree.getZTreeObj("treeDemo");

            var nodese = treeObje.getCheckedNodes()
            //nodes = Json
            //console.log(nodes)
            var trees = '';
            for(var i=0;i<nodese.length;i++){
                var treeNodes = nodese[i]
                if(treeNodes.checked == true){
                    trees += treeNodes.id + ',';
                }
                //console.log((treeNodes?treeNodes.name:"root") + "checked " +(treeNodes.checked?"true":"false"));
            }
            //console.log(tree)
            $("input[name='wid']").val(trees)

        });

        var newCount = 1;
        function addHoverDom(treeId, treeNode) {
            var sObj = $("#" + treeNode.tId + "_span");
            if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
            /*var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
                + "' title='add node' onfocus='this.blur();'></span>";
            sObj.after(addStr);*/
            var btn = $("#addBtn_"+treeNode.tId);
            if (btn) btn.bind("click", function(){
                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
                zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, name:"new node" + (newCount++)});
                return false;
            });
        }
        function removeHoverDom(treeId, treeNode) {
            $("#addBtn_"+treeNode.tId).unbind().remove();
        }

        foredit.on("submit", function(wizard) {
            setTimeout(function() {
                wizard.trigger("success");
                wizard.hideButtons();
                wizard._submitting = false;
                wizard.showSubmitCard("success");
                wizard.updateProgressBar(0);
            }, 3000);
            esave();
            foredit.reset().close();
            //刷新页面
            window.location.reload();
        });
        $('.wizard-cancel').click(function () {
            //刷新页面
            window.location.reload();
        })
        $('.wizard-close').click(function () {
            //刷新页面
            window.location.reload();
        })
    }
    function esave() {
        var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
        var nodes = treeObj.getCheckedNodes();
        //console.log(nodes,'nodesnodesnodesnodes')

        var tree = '';
        for(var i=0;i<nodes.length;i++){
            var treeNode = nodes[i]
            if(treeNode.checked == true){
                tree += treeNode.id + ',';
            }
            //console.log((treeNode?treeNode.name:"root") + "checked " +(treeNode.checked?"true":"false"));
        }
        //console.log(tree)
        $("input[name='wid']").val(tree)

        var wid = $("input[name='wid']").val();
        var role_id = $("input[name='role_id_edit']").val();
        var role_name = $("input[name='role_name']").val();
        var remark = $("input[name='remark']").val();
        var status = $("select[name='status']").val();
        var data = {'wid':wid,'role_id':role_id,'role_name':role_name,'remark':remark,'status':status};
        console.log(data)
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "<?php echo url('Role/esave'); ?>",//url
            data: data,
            success: function (result) {
                //console.log(result)
                var code = result.code
                var msg = result.msg
                changeText(msg, code)
                //console.log('123'+code)
            },
            error:function (result) {
                var code = 0
                var msg = '服务器错误';
                changeText(msg, code)
                return false;
            }
        });
    }
</script>
</body>
</html>
									<!--删除弹出框-->
									<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>删除</title>
    <style>
        .delete{
            display: none;
        }
    </style>
</head>
<body>
<!--删除 弹框-->
<div class="delete">
    <form method="post" onsubmit="delId()" enctype="multipart/form-data">
        <input hidden type="text" name="role_id">
        <div id="delete">
            <div class="ltitle">温馨提示</div>
            <div class="lcon">
                <img src="__IMG__/jinggao.png" alt="">
                <p>确定删除?</p>
            </div>
            <div class="alert-btn">
                <button type="submit" class="alert-sure" style="margin-left: 30%;">确定</button>
                <span class="alert-cancel">取消</span>
            </div>
        </div>
    </form>
</div>
<script src="__JS__/jquery.js"></script>
<script>

    function delId() {
        var role_id = $("input[name='role_id']").val()
        //console.log(model_id)
        var data = {'role_id':role_id}
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "<?php echo url('Role/del'); ?>",//url
            data: data,
            success: function (result) {
                var code = result.code;
                var msg = result.msg;
                changeText(msg, code)
            },
            error:function (result) {
                alert('服务器错误')
                return false;
            }
        });
    }

</script>
</body>
</html>
								</div>
							</div>
						</div>
			</div>
		</div>
	</div>
	<!--foot-->
	<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<footer id="footer-bar">
    <p id="footer-copyright">
        &copy; 2018 Laison
        <!--<a href="http://www.adbee.sk/" target="_blank">Adbee digital</a>. Powered by SuperheroAdmin.-->
    </p>
</footer>
</body>
</html>

	<!-- global scripts -->
	<script src="__JS__/jquery.js"></script>

	<script src="__JS__/bootstrap.min.js"></script>

	<!-- this page specific scripts -->
	<script src="__JS__/bootstrap-wizard.js"></script>
	<script src="__JS__/select2.min.js"></script>

	<!-- theme scripts -->
	<script src="__JS__/scripts.js"></script>
	<script src="__JS__/bootstrap-table.js"></script>
	<script src="__JS__/bootstrap-table-fixed-columns.js"></script>
	<!--ztree-->
	<script type="text/javascript" src="__JS__/ztree/jquery.ztree.core.js"></script>
	<script type="text/javascript" src="__JS__/ztree/jquery.ztree.excheck.js"></script>
	<script type="text/javascript" src="__JS__/ztree/jquery.ztree.exedit.js"></script>

	<script>
		/*$('#fixedTable').bootstrapTable('destroy').bootstrapTable({
            fixedColumns: true,//固定列
            fixedNumber:2 //固定前两列
		})*/
        $(function() {

            $('#sel2').select2();

            $.fn.wizard.logging = false;

            var wizard = $("#wizard-demo").wizard({
                showCancel: true
            });

            wizard.el.find(".wizard-ns-select").change(function() {
                wizard.el.find(".wizard-ns-detail").show();
            });

            wizard.el.find(".create-server-service-list").change(function() {
                var noOption = $(this).find("option:selected").length == 0;
                wizard.getCard(this).toggleAlert(null, noOption);
            });

            wizard.cards["name"].on("validated", function(card) {
                var hostname = card.el.find("#new-server-fqdn").val();
            });

            wizard.on("submit", function(wizard) {
                /*var submit = {
                    "hostname": $("#new-server-fqdn").val()
                };*/

                setTimeout(function() {
                    wizard.trigger("success");
                    wizard.hideButtons();
                    wizard._submitting = false;
                    wizard.showSubmitCard("success");
                    wizard.updateProgressBar(0);
                }, 1000);
				add();
                wizard.reset().close();
				//刷新页面
				window.location.reload();

            });
            $(".wizard-group-list").click(function() {
                alert("Disabled for demo.");
            });

            $("#open-wizard").click(function() {
                wizard.show();
                $('.wizard-cancel').text('取消');
                $('.wizard-cancel').addClass('calCancel')
                // $('.wizard-next').addClass('calCancel')
                $('.wizard-next').text('确定');
            });

            //wizard.show();
        });
        /*提示信息不显示*/
        $("#msg").addClass('forhid')
        function add() {
            var treeObj = $.fn.zTree.getZTreeObj("treeAdd");
            var nodes = treeObj.getCheckedNodes();
            var tree = '';
            for(var i=0;i<nodes.length;i++){
                var treeNode = nodes[i]
                if(treeNode.checked == true){
                    tree += treeNode.id + ',';
                }
                //console.log((treeNode?treeNode.name:"root") + "checked " +(treeNode.checked?"true":"false"));
            }
            //console.log(tree)
            $("input[name='wid_add']").val(tree)

            var role_name = $("input[name='role_name_add']").val();
            var remark = $("input[name='remark_add']").val();
            var wid = $("input[name='wid_add']").val();
            var status = $("select[name='status_add']").val();
            var data = {'role_name':role_name,'remark':remark,'wid':wid,'status':status};
            console.log(data)
            $.ajax({
                //几个参数需要注意一下
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "<?php echo url('Role/save'); ?>",//url
                data: data,
                success: function (result) {
                    var code = result.code
					var msg = result.msg
                    changeText(msg, code)
					return true;
                },
                error:function (result) {
                    var code = 0
					var msg = '服务器错误';
                    changeText(msg, code)
                    return false;
                }
            });
        }
        function changeText(msg, code) {
            $('#sp').text(msg)
            if(code != 1){
                $('#img').attr('src', '__IMG__/fail.png')
            }
            $("#msg").removeClass('forhid')
            setTimeout("showOrHid()",3000)
        }
        function showOrHid() {
            //console.log('123')
            $("#msg").addClass('forhid')
        }

        function del(role_id) {
            $.post("<?php echo url('Role/one'); ?>",{role_id:role_id},function(data){
                // console.log(data);
                if(data) {
                    $("input[name='role_id']").val(data[0].role_id)
                }
            },'json');

        }

        $(function () {
            $(".alert-close").click(function () {
                $(".delete").css("display","none")
            })
            $(".alert-cancel").click(function () {
                $(".delete").css("display","none")
            })
            $(".class-del").click(function () {
                $(".delete").css("display","block")
            })

        })
	</script>
</body>
</html>